<?php

declare(strict_types=1);

namespace app\admin\controller\order;

use app\admin\controller\Controller;
use app\api\service\OrderService;
use app\admin\model\order\Power as PowerOrder;

class Power extends Controller
{
    public $orderModel = PowerOrder::class;
    public $servType = PRODUCT_POWER_SERV;

    /**
     * @api {GET} /admin/order.power 电费订单列表
     */
    public function index()
    {
        $model = new PowerOrder();
        $data = input('post.');

        return $model->getList($data);
    }

    /**
     * 退款.
     */
    public function refund()
    {
        $model = new PowerOrder();
        $res = $model->refund(input('post.id'));
        if (false === $res) {
            return fail($model->getError());
        }

        return success('退款成功');
    }
}
